<!DOCTYPE html>
<html class="bg-white">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>${SYSTEM_NAME}</title>
    <meta name="description" content="${SYSTEM_NAME}">

    <!--其他插件css-->
    <!--<link rel="stylesheet" href="${ctxPath}/assets/common/layui/css/layui.css"/>-->
    <!--<link rel="stylesheet" href="${ctxPath}/assets/plugins/layui/css/layui.css"/>-->
    <link rel="stylesheet" href="${ctxPath}/assets/plugins/layui/css/layui.css"/>
    <link href="${ctxPath}/assets/expand/plugins/ztree/zTreeStyle.css" rel="stylesheet" type="text/css"/>
</head>

<body>
<div id="deptForm" class="layui-fluid">
    <div class="layui-row" style="margin-top:15px;background: #f2f7f8;padding: 20px;">
        <ul id="zTree" class="ztree"></ul>
    </div>
    <div class="layui-row" style="background: #CFD4D5;padding: 10px;">
        <div style="text-align: center;">
            <button class="layui-btn layui-btn-sm" id="saveButton">保存</button>
            <button class="layui-btn layui-btn-sm layui-btn-primary" type="button" ew-event="closeDialog">取消</button>
        </div>
    </div>
</div>
</body>

<script type="text/javascript">
    var Feng = {
        ctxPath: "",
        addCtx: function (ctx) {
            if (this.ctxPath === "") {
                this.ctxPath = ctx;
            }
        }
    };
    Feng.addCtx("${ctxPath}");
</script>
<!--<script type="text/javascript" src="${ctxPath}/assets/common/layui/layui.js"></script>-->
<script type="text/javascript" src="${ctxPath}/assets/plugins/layui/layui.js"></script>
<script type="text/javascript" src="${ctxPath}/assets/common/js/common.js"></script>

<!--<script type="text/javascript" src="${ctxPath}/assets/expand/plugins/jquery/jquery-3.2.1.min.js"></script>-->
<script type="text/javascript" src="${ctxPath}/assets/expand/plugins/jquery/jquery-3.2.1.min.js"></script>
<!--<script type="text/javascript" src="${ctxPath}/assets/expand/plugins/ztree/jquery.ztree.all.min.js"></script>-->
<!--<script type="text/javascript" src="${ctxPath}/assets/plugins/ztree/jquery.ztree.all.min.js"></script>-->
<!--<script type="text/javascript" src="${ctxPath}/assets/plugins/ztree/jquery.ztree.all.min.js"></script>-->
<!--<script type="text/javascript" src="${ctxPath}/assets/plugins/ztree/jquery.ztree.all.min.js"></script>-->
<!--<script type="text/javascript" src="${ctxPath}/assets/plugins/ztree/jquery.ztree.all.min.js"></script>-->
<!--<script type="text/javascript" src="${ctxPath}/assets/plugins/ztree/jquery.ztree.all.min.js"></script>-->
<!--<script type="text/javascript" src="${ctxPath}/assets/plugins/ztree/jquery.ztree.all.min.js"></script>-->
<!--<script type="text/javascript" src="${ctxPath}/assets/plugins/ztree/jquery.ztree.all.min.js"></script>-->
<!--<script type="text/javascript" src="${ctxPath}/assets/plugins/ztree/jquery.ztree.all.min.js"></script>-->
<!--<script type="text/javascript" src="${ctxPath}/assets/plugins/ztree/jquery.ztree.all.min.js"></script>-->
<!--<script type="text/javascript" src="${ctxPath}/assets/plugins/ztree/jquery.ztree.all.min.js"></script>-->
<!--<script type="text/javascript" src="${ctxPath}/assets/plugins/ztree/jquery.ztree.all.min.js"></script>-->
<!--<script type="text/javascript" src="${ctxPath}/assets/plugins/ztree/jquery.ztree.all.min.js"></script>-->
<!--<script type="text/javascript" src="${ctxPath}/assets/plugins/ztree/jquery.ztree.all.min.js"></script>-->
<!--<script type="text/javascript" src="${ctxPath}/assets/plugins/ztree/jquery.ztree.all.min.js"></script>-->
<!--<script type="text/javascript" src="${ctxPath}/assets/plugins/ztree/jquery.ztree.all.min.js"></script>-->
<!--<script type="text/javascript" src="${ctxPath}/assets/plugins/ztree/jquery.ztree.all.min.js"></script>-->
<!--<script type="text/javascript" src="${ctxPath}/assets/plugins/ztree/jquery.ztree.all.min.js"></script>-->
<!--<script type="text/javascript" src="${ctxPath}/assets/plugins/ztree/jquery.ztree.all.min.js"></script>-->
<!--<script type="text/javascript" src="${ctxPath}/assets/plugins/ztree/jquery.ztree.all.min.js"></script>-->
<!--<script type="text/javascript" src="${ctxPath}/assets/plugins/ztree/jquery.ztree.all.min.js"></script>-->
<!--<script type="text/javascript" src="${ctxPath}/assets/plugins/ztree/jquery.ztree.all.min.js"></script>-->
<!--<script type="text/javascript" src="${ctxPath}/assets/plugins/ztree/jquery.ztree.all.min.js"></script>-->
<script type="text/javascript" src="${ctxPath}/assets/plugins/ztree/jquery.ztree.all.min.js"></script>

<script type="text/javascript">


    layui.use(['ztree'], function () {
        var $ZTree = layui.ztree;

        var ZTreeDlg = {
            index: parent.layer.getFrameIndex(window.name),
            tempName: "",
            tempId: ""
        };

        ZTreeDlg.onClickItem = function (e, treeId, treeNode) {
            ZTreeDlg.tempName = ZTreeDlg.instance.getSelectedVal();
            ZTreeDlg.tempId = treeNode.id;
        };

        ZTreeDlg.onDBClickItem = function (e, treeId, treeNode) {
            ${formName} = ZTreeDlg.instance.getSelectedVal();
            ${formId} = treeNode.id;
            parent.layer.close(ZTreeDlg.index);
        };

        $("#saveButton").bind("click", function () {
            ${formName} = ZTreeDlg.tempName;
            ${formId} = ZTreeDlg.tempId;
            parent.layer.close(ZTreeDlg.index);
        });

        var ztree = new $ZTree("zTree", "${treeUrl}");
        ztree.bindOnClick(ZTreeDlg.onClickItem);
        ztree.bindOnDblClick(ZTreeDlg.onDBClickItem);
        ztree.init();
        ZTreeDlg.instance = ztree;
    });

</script>

</body>

</html>
